<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<title>easy-template.js</title>
</head>

<body>
	<div id="wp"></div>
	<script id="tpl" type="text/html">
			<h2>easy-template.js</h2>
			<h3>by --levi</h3>
			<%=data.newsTpl%><br/><br/>
			<%for(i = 0; i < data.list.length; i++) {%>
				<%=list[i].title%><br/>
				<%=list[i].content%><br/>
				<%=list[i].desc%><br/>
			<%}%>
        </script>

	<script src="js/leeyaTemplate.js"></script>
	<script>
		let data = {
			newsTpl: "hello world",
			list: [{
				title: 'this is my first data',
				content: 'hello world 1'
			},
			{
				title: 'this is my second data',
				content: 'hello world 2'
			},
			{
				title: 'this is my third data',
				content: 'hello world 3'
			}]
		}

		var html = template.init(document.getElementById('tpl').innerHTML, data);
		document.getElementById('wp').innerHTML = html;
	</script>
</body>

</html>